op = zeros(1,8);
s = sum(op);
k = 1;
while s < 8
    pos = randi(8,1);
    if op(pos) == 0
        op(pos) = 1;
        ind(k) = pos;
        k = k + 1;
    end
    s = sum(op);
end



